package com.example.qqbotdemo.config;

import lombok.extern.log4j.Log4j2;
import net.mamoe.mirai.utils.MiraiLoggerPlatformBase;
import org.jetbrains.annotations.Nullable;
import org.springframework.stereotype.Component;

@Log4j2
@Component
public class MiraiLogConfig extends MiraiLoggerPlatformBase {

    private final String identity = "miraiLog :::: ";

    @Nullable
    @Override
    public String getIdentity() {
        return identity;
    }

    @Override
    protected void debug0(@Nullable String s, @Nullable Throwable throwable) {
        log.debug(s, throwable);
    }

    @Override
    protected void error0(@Nullable String s, @Nullable Throwable throwable) {
        log.error(s, throwable);
    }

    @Override
    protected void info0(@Nullable String s, @Nullable Throwable throwable) {
        log.info(s, throwable);
    }

    @Override
    protected void verbose0(@Nullable String s, @Nullable Throwable throwable) {
        log.trace(s, throwable);
    }

    @Override
    protected void warning0(@Nullable String s, @Nullable Throwable throwable) {
        log.warn(s, throwable);
    }

    @Override
    public boolean isDebugEnabled() {
        return true;
    }

    @Override
    public boolean isErrorEnabled() {
        return true;
    }

    @Override
    public boolean isInfoEnabled() {
        return true;
    }

    @Override
    public boolean isVerboseEnabled() {
        return true;
    }

    @Override
    public boolean isWarningEnabled() {
        return true;
    }

    @Override
    public void debug(@Nullable Throwable e) {
        log.debug(e);
    }

    @Override
    public void error(@Nullable Throwable e) {
        log.error(e);
    }

    @Override
    public void info(@Nullable Throwable e) {
        log.info(e);
    }

    @Override
    public void warning(@Nullable Throwable e) {
        log.warn(e);
    }
}
